Skip to content

feat(observability): Langfuse Agent-Graph-view metadata + host span-metadata injector#11

Merged
senamakel merged 1 commit into
tinyhumansai:mainfrom
senamakel:feat/langfuse-langgraph-metadata
Jul 4, 2026
Merged

feat(observability): Langfuse Agent-Graph-view metadata + host span-metadata injector#11
senamakel merged 1 commit into
tinyhumansai:mainfrom
senamakel:feat/langfuse-langgraph-metadata

Conversation

@senamakel

Copy link
Copy Markdown
Member

What

Two additions to GraphLangfuseExporter (src/graph/observability/langfuse.rs), both non-breaking:

  1. LangGraph-convention metadata keys: node spans now carry langgraph_node (node id) and langgraph_step (superstep index); step and subgraph spans carry langgraph_step. Langfuse's Agent Graph view is keyed to these LangGraph metadata conventions, so stamping them makes Langfuse render our graph runs natively in the graph visualization.
  2. Host span-metadata injector: GraphLangfuseExporter::with_span_metadata_fn(Fn(&GraphObservation) -> Option<Map>) lets hosts merge extra per-span metadata (host keys win on collision; spans only, point events untouched). Previously span metadata was hardcoded with no extension point. SpanMetadataFn is re-exported from the module, graph, and crate root.

Why

Part of the Langfuse observability overhaul across the OpenHuman stack: openhuman is wiring flow/graph runs into Langfuse via this exporter (companion PRs: tinyhumansai/tinyflows journaled-run entry points, tinyhumansai/openhuman flows-domain export hook, tinyhumansai/backend#1069). Without these keys the Langfuse Agent Graph view cannot render our graphs; without the injector the host cannot stamp flow-level attribution (e.g. flow_id) per span.

Testing

cargo test --lib graph::observability — 23 passed, 0 failed (3 new tests: langgraph keys on node/step spans, subgraph step key, injector merge/override + point-event isolation).

https://claude.ai/code/session_01VSwRwLDBXg3o6timchvKn8

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 32 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e40c5b99-40b0-4b1e-a332-3aafdb50771e

📥 Commits

Reviewing files that changed from the base of the PR and between 74de1a6 and 60e9701.

📒 Files selected for processing (5)
  • src/graph/mod.rs
  • src/graph/observability/langfuse.rs
  • src/graph/observability/langfuse/tests.rs
  • src/graph/observability/mod.rs
  • src/lib.rs

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d6e98e8adf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +795 to +797
if request.messages[i].text() == self.placeholder {
continue;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Don't skip compaction from text alone

When an older Message::Tool contains non-text ContentBlocks plus text equal to the placeholder (or when the placeholder is empty and the tool body is structured-only), this check treats it as already compacted and leaves the original content blocks in place. Since Message supports JSON/image/provider-extension blocks and this middleware promises to blank stale tool-result bodies, those payloads can remain in the transcript for downstream middleware or providers that preserve structured content; only skip when the actual tool content is exactly a single placeholder text block.

Useful? React with 👍 / 👎.

…n-metadata injector on graph Langfuse exporter

- node spans now carry langgraph_node (node id) and langgraph_step
  (superstep index) in metadata so Langfuse's Agent Graph view can lay
  the trace out as a graph; step spans carry langgraph_step; subgraph
  spans carry langgraph_step from their coordinate observation
- GraphLangfuseExporter::with_span_metadata_fn installs an optional host
  metadata injector (Fn(&GraphObservation) -> Option<Map>) merged over
  built-in span metadata keys (host wins on collision); default None,
  non-breaking
- re-export SpanMetadataFn from graph/observability, graph, and crate root

Claude-Session: https://claude.ai/code/session_01VSwRwLDBXg3o6timchvKn8
@senamakel
senamakel force-pushed the feat/langfuse-langgraph-metadata branch from d6e98e8 to 60e9701 Compare July 4, 2026 11:37
@senamakel
senamakel merged commit 2f023e8 into tinyhumansai:main Jul 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant